using System;
using Castle.ActiveRecord;
using CosyTrade.Data;

namespace CosyTrade.Security
{
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [ActiveRecord("tbFunction"), Serializable]
    public class Function : BusinessObject
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        private string functionKey;
        private string functionCaption;
        private int orderIndex;
        private byte[] iconData;

        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access=PropertyAccess.NosetterCamelcase)]
        public Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        [Property(Unique=true, NotNull=true)]
        public string FunctionKey
        {
            get { return functionKey; }
            set { functionKey = value; }
        }

        [Property]
        public string FunctionCaption
        {
            get { return functionCaption; }
            set { functionCaption = value; }
        }

        [Property]
        public int OrderIndex
        {
            get { return orderIndex; }
            set { orderIndex = value; }
        }

        [Property]
        public byte[] IconData
        {
            get { return iconData; }
            set { iconData = value; }
        }
    }
}